@@ -1,8 +1,20 @@ |
||
1 | 1 |
module ApplicationHelper |
2 |
- def nav_link(name, path, options = {}, &block) |
|
3 |
- if glyphicon = options.delete(:glyphicon) |
|
4 |
- name = "<span class='glyphicon glyphicon-#{glyphicon}'></span> ".html_safe + name |
|
2 |
+ def icon_tag(name, options = {}) |
|
3 |
+ if dom_class = options[:class] |
|
4 |
+ dom_class = ' ' << dom_class |
|
5 |
+ end |
|
6 |
+ |
|
7 |
+ case name |
|
8 |
+ when /\Aglyphicon-/ |
|
9 |
+ "<span class='glyphicon #{name}#{dom_class}'></span>".html_safe |
|
10 |
+ when /\Afa-/ |
|
11 |
+ "<i class='fa #{name}#{dom_class}'></i>".html_safe |
|
12 |
+ else |
|
13 |
+ raise "Unrecognized icon name: #{name}" |
|
5 | 14 |
end |
15 |
+ end |
|
16 |
+ |
|
17 |
+ def nav_link(name, path, options = {}, &block) |
|
6 | 18 |
content = link_to(name, path, options) |
7 | 19 |
active = current_page?(path) |
8 | 20 |
if block |
@@ -44,9 +56,9 @@ module ApplicationHelper |
||
44 | 56 |
def omniauth_provider_icon(provider) |
45 | 57 |
case provider.to_sym |
46 | 58 |
when :twitter, :tumblr, :github, :dropbox |
47 |
- content_tag :i, '', class: "fa fa-#{provider}" |
|
59 |
+ icon_tag("fa-#{provider}") |
|
48 | 60 |
else |
49 |
- content_tag :i, '', class: "fa fa-lock" |
|
61 |
+ icon_tag("fa-lock") |
|
50 | 62 |
end |
51 | 63 |
end |
52 | 64 |
|
@@ -1,30 +1,30 @@ |
||
1 | 1 |
<ul class="dropdown-menu" role="menu"> |
2 | 2 |
<% if agent.can_be_scheduled? %> |
3 | 3 |
<li> |
4 |
- <%= link_to '<span class="color-success glyphicon glyphicon-refresh"></span> Run'.html_safe, run_agent_path(agent, :return => returnTo), method: :post, :tabindex => "-1" %> |
|
4 |
+ <%= link_to icon_tag('glyphicon-refresh', class: 'color-success') + ' Run', run_agent_path(agent, return: returnTo), method: :post, tabindex: "-1" %> |
|
5 | 5 |
</li> |
6 | 6 |
<% end %> |
7 | 7 |
|
8 | 8 |
<li> |
9 |
- <%= link_to '<span class="glyphicon glyphicon-eye-open"></span> Show'.html_safe, agent_path(agent) %> |
|
9 |
+ <%= link_to icon_tag('glyphicon-eye-open') + ' Show'.html_safe, agent_path(agent) %> |
|
10 | 10 |
</li> |
11 | 11 |
|
12 | 12 |
<li class="divider"></li> |
13 | 13 |
|
14 | 14 |
<li> |
15 |
- <%= link_to '<span class="glyphicon glyphicon-pencil"></span> Edit agent'.html_safe, edit_agent_path(agent) %> |
|
15 |
+ <%= link_to icon_tag('glyphicon-pencil') + ' Edit agent'.html_safe, edit_agent_path(agent) %> |
|
16 | 16 |
</li> |
17 | 17 |
|
18 | 18 |
<li> |
19 |
- <%= link_to '<span class="glyphicon glyphicon-plus"></span> Clone agent'.html_safe, new_agent_path(id: agent), :tabindex => "-1" %> |
|
19 |
+ <%= link_to icon_tag('glyphicon-plus') + ' Clone agent'.html_safe, new_agent_path(id: agent), tabindex: "-1" %> |
|
20 | 20 |
</li> |
21 | 21 |
|
22 | 22 |
<li> |
23 | 23 |
<%= link_to '#', 'data-toggle' => 'modal', 'data-target' => "#confirm-agent#{agent.id}" do %> |
24 | 24 |
<% if agent.disabled? %> |
25 |
- <i class="glyphicon glyphicon-play"></i> Enable agent |
|
25 |
+ <%= icon_tag('glyphicon-play') %> Enable agent |
|
26 | 26 |
<% else %> |
27 |
- <i class="glyphicon glyphicon-pause"></i> Disable agent |
|
27 |
+ <%= icon_tag('glyphicon-pause') %> Disable agent |
|
28 | 28 |
<% end %> |
29 | 29 |
<% end %> |
30 | 30 |
</li> |
@@ -34,7 +34,7 @@ |
||
34 | 34 |
|
35 | 35 |
<% agent.scenarios.each do |scenario| %> |
36 | 36 |
<li> |
37 |
- <%= link_to "<span class='color-warning glyphicon glyphicon-remove-circle'></span> Remove from #{scenario_label(scenario)}".html_safe, leave_scenario_agent_path(agent, :scenario_id => scenario.to_param, :return => returnTo), method: :put, :tabindex => "-1" %> |
|
37 |
+ <%= link_to icon_tag('glyphicon-remove-circle', class: 'color-warning') + " Remove from #{scenario_label(scenario)}".html_safe, leave_scenario_agent_path(agent, scenario_id: scenario.to_param, return: returnTo), method: :put, tabindex: "-1" %> |
|
38 | 38 |
</li> |
39 | 39 |
<% end %> |
40 | 40 |
<% end %> |
@@ -43,12 +43,12 @@ |
||
43 | 43 |
|
44 | 44 |
<% if agent.can_create_events? && agent.events.count > 0 %> |
45 | 45 |
<li> |
46 |
- <%= link_to '<span class="color-danger glyphicon glyphicon-trash"></span> Delete all events'.html_safe, remove_events_agent_path(agent, :return => returnTo), method: :delete, data: {confirm: 'Are you sure you want to delete ALL emitted events for this Agent?'}, :tabindex => "-1" %> |
|
46 |
+ <%= link_to icon_tag('glyphicon-trash', class: 'color-danger') + ' Delete all events', remove_events_agent_path(agent, return: returnTo), method: :delete, data: {confirm: 'Are you sure you want to delete ALL emitted events for this Agent?'}, tabindex: "-1" %> |
|
47 | 47 |
</li> |
48 | 48 |
<% end %> |
49 | 49 |
|
50 | 50 |
<li> |
51 |
- <%= link_to '<span class="color-danger glyphicon glyphicon-remove"></span> Delete agent'.html_safe, agent_path(agent, :return => returnTo), method: :delete, data: { confirm: 'Are you sure that you want to permanently delete this Agent?' }, :tabindex => "-1" %> |
|
51 |
+ <%= link_to icon_tag('glyphicon-remove', class: 'color-danger') + ' Delete agent', agent_path(agent, return: returnTo), method: :delete, data: { confirm: 'Are you sure that you want to permanently delete this Agent?' }, tabindex: "-1" %> |
|
52 | 52 |
</li> |
53 | 53 |
</ul> |
54 | 54 |
|
@@ -17,9 +17,9 @@ |
||
17 | 17 |
<div class="row"> |
18 | 18 |
<div class="col-md-12"> |
19 | 19 |
<div class="btn-group"> |
20 |
- <%= link_to '<span class="glyphicon glyphicon-chevron-left"></span> Back'.html_safe, agents_path, class: "btn btn-default" %> |
|
21 |
- <%= link_to '<span class="glyphicon glyphicon-asterisk"></span> Show'.html_safe, agent_path(@agent), class: "btn btn-default" %> |
|
20 |
+ <%= link_to icon_tag('glyphicon-chevron-left') + ' Back', agents_path, class: "btn btn-default" %> |
|
21 |
+ <%= link_to icon_tag('glyphicon-asterisk') + ' Show', agent_path(@agent), class: "btn btn-default" %> |
|
22 | 22 |
</div> |
23 | 23 |
</div> |
24 | 24 |
</div> |
25 |
-</div> |
|
25 |
+</div> |
@@ -10,9 +10,9 @@ |
||
10 | 10 |
<br/> |
11 | 11 |
|
12 | 12 |
<div class="btn-group"> |
13 |
- <%= link_to '<span class="glyphicon glyphicon-plus"></span> New Agent'.html_safe, new_agent_path, class: "btn btn-default" %> |
|
14 |
- <%= link_to '<span class="glyphicon glyphicon-refresh"></span> Run event propagation'.html_safe, propagate_agents_path, method: 'post', class: "btn btn-default" %> |
|
15 |
- <%= link_to '<span class="glyphicon glyphicon-random"></span> View diagram'.html_safe, diagram_path, class: "btn btn-default" %> |
|
13 |
+ <%= link_to icon_tag('glyphicon-plus') + ' New Agent', new_agent_path, class: "btn btn-default" %> |
|
14 |
+ <%= link_to icon_tag('glyphicon-refresh') + ' Run event propagation', propagate_agents_path, method: 'post', class: "btn btn-default" %> |
|
15 |
+ <%= link_to icon_tag('glyphicon-random') + ' View diagram', diagram_path, class: "btn btn-default" %> |
|
16 | 16 |
</div> |
17 | 17 |
</div> |
18 | 18 |
</div> |
@@ -14,9 +14,9 @@ |
||
14 | 14 |
|
15 | 15 |
<div class="row"> |
16 | 16 |
<div class="col-md-12"> |
17 |
- <%= link_to '<span class="glyphicon glyphicon-chevron-left"></span> Back'.html_safe, agents_path, class: "btn btn-default" %> |
|
17 |
+ <%= link_to icon_tag('glyphicon-chevron-left') + ' Back'.html_safe, agents_path, class: "btn btn-default" %> |
|
18 | 18 |
</div> |
19 | 19 |
</div> |
20 | 20 |
</div> |
21 | 21 |
</div> |
22 |
-</div> |
|
22 |
+</div> |
@@ -2,7 +2,7 @@ |
||
2 | 2 |
<div class='row'> |
3 | 3 |
<div class='col-md-2'> |
4 | 4 |
<ul class="nav nav-pills nav-stacked" id="show-tabs"> |
5 |
- <li><%= link_to '<span class="glyphicon glyphicon-chevron-left"></span> Back'.html_safe, agents_path %></li> |
|
5 |
+ <li><%= link_to icon_tag('glyphicon-chevron-left') + ' Back'.html_safe, agents_path %></li> |
|
6 | 6 |
|
7 | 7 |
<% if agent_show_view(@agent).present? %> |
8 | 8 |
<li class='active'><a href="#summary" data-toggle="tab"><span class='glyphicon glyphicon-picture'></span> Summary</a></li> |
@@ -15,7 +15,7 @@ |
||
15 | 15 |
<li><a href="#logs" data-toggle="tab" data-agent-id="<%= @agent.id %>" class='<%= @agent.recent_error_logs? ? 'recent-errors' : '' %>'><span class='glyphicon glyphicon-list-alt'></span> Logs</a></li> |
16 | 16 |
|
17 | 17 |
<% if @agent.can_create_events? && @agent.events.count > 0 %> |
18 |
- <li><%= link_to '<span class="glyphicon glyphicon-random"></span> Events'.html_safe, agent_events_path(@agent) %></li> |
|
18 |
+ <li><%= link_to icon_tag('glyphicon-random') + ' Events'.html_safe, agent_events_path(@agent) %></li> |
|
19 | 19 |
<% else %> |
20 | 20 |
<li class='disabled'><a><span class='glyphicon glyphicon-random'></span> Events</a></li> |
21 | 21 |
<% end %> |
@@ -9,7 +9,7 @@ |
||
9 | 9 |
<h2>Agent Event Flow</h2> |
10 | 10 |
</div> |
11 | 11 |
<div class="btn-group"> |
12 |
- <%= link_to '<span class="glyphicon glyphicon-chevron-left"></span> Back'.html_safe, (params[:scenario_id] ? scenario_path(params[:scenario_id]) : agents_path), class: "btn btn-default" %> |
|
12 |
+ <%= link_to icon_tag('glyphicon-chevron-left') + ' Back'.html_safe, (params[:scenario_id] ? scenario_path(params[:scenario_id]) : agents_path), class: "btn btn-default" %> |
|
13 | 13 |
</div> |
14 | 14 |
|
15 | 15 |
<div class='digraph'> |
@@ -40,8 +40,8 @@ |
||
40 | 40 |
|
41 | 41 |
<% if @agent %> |
42 | 42 |
<div class="btn-group"> |
43 |
- <%= link_to '<span class="glyphicon glyphicon-chevron-left"></span> Back'.html_safe, agents_path, class: "btn btn-default" %> |
|
44 |
- <%= link_to '<span class="glyphicon glyphicon-random""></span> See all events'.html_safe, events_path, class: "btn btn-default" %> |
|
43 |
+ <%= link_to icon_tag('glyphicon-chevron-left') + ' Back'.html_safe, agents_path, class: "btn btn-default" %> |
|
44 |
+ <%= link_to icon_tag('glyphicon-random') + ' See all events'.html_safe, events_path, class: "btn btn-default" %> |
|
45 | 45 |
</div> |
46 | 46 |
<% end %> |
47 | 47 |
</div> |
@@ -46,7 +46,7 @@ |
||
46 | 46 |
|
47 | 47 |
<br /> |
48 | 48 |
<div class="btn-group"> |
49 |
- <%= link_to '<span class="glyphicon glyphicon-chevron-left"></span> Back'.html_safe, events_path, class: "btn btn-default" %> |
|
49 |
+ <%= link_to icon_tag('glyphicon-chevron-left') + ' Back'.html_safe, events_path, class: "btn btn-default" %> |
|
50 | 50 |
</div> |
51 | 51 |
</div> |
52 | 52 |
</div> |
@@ -14,9 +14,9 @@ |
||
14 | 14 |
<ul class='nav navbar-nav'> |
15 | 15 |
<%= nav_link "Agents", agents_path do %> |
16 | 16 |
<ul class='dropdown-menu' role='menu'> |
17 |
- <%= nav_link "New Agent", new_agent_path, glyphicon: "plus" %> |
|
18 |
- <%= nav_link "Run event propagation", propagate_agents_path, method: 'post', glyphicon: "refresh" %> |
|
19 |
- <%= nav_link "View Diagram", diagram_path, glyphicon: 'random' %> |
|
17 |
+ <%= nav_link icon_tag('glyphicon-plus') + " New Agent", new_agent_path %> |
|
18 |
+ <%= nav_link icon_tag('glyphicon-refresh') + " Run event propagation", propagate_agents_path, method: 'post' %> |
|
19 |
+ <%= nav_link icon_tag('glyphicon-random') + " View Diagram", diagram_path %> |
|
20 | 20 |
</ul> |
21 | 21 |
<% end %> |
22 | 22 |
<%= nav_link "Scenarios", scenarios_path %> |
@@ -37,22 +37,22 @@ |
||
37 | 37 |
|
38 | 38 |
<li class='job-indicator' role='pending'> |
39 | 39 |
<%= link_to current_user.admin? ? jobs_path : '#', class: 'visible-lg' do %> |
40 |
- <span class="badge"><span class="glyphicon glyphicon-refresh icon-white"></span> <span class='number'>0</span></span> |
|
40 |
+ <span class="badge"><%= icon_tag('glyphicon-refresh', class: 'icon-white') %> <span class='number'>0</span></span> |
|
41 | 41 |
<% end %> |
42 | 42 |
</li> |
43 | 43 |
<li class='job-indicator' role='awaiting_retry'> |
44 | 44 |
<%= link_to current_user.admin? ? jobs_path : '#', class: 'visible-lg' do %> |
45 |
- <span class="badge"><span class="glyphicon glyphicon-question-sign icon-yellow"></span> <span class='number'>0</span></span> |
|
45 |
+ <span class="badge"><%= icon_tag('glyphicon-question-sign', class: 'icon-yellow') %> <span class='number'>0</span></span> |
|
46 | 46 |
<% end %> |
47 | 47 |
</li> |
48 | 48 |
<li class='job-indicator' role='recent_failures'> |
49 | 49 |
<%= link_to current_user.admin? ? jobs_path : '#', class: 'hidden-sm hidden-xs' do %> |
50 |
- <span class="badge"><span class="glyphicon glyphicon-exclamation-sign icon-white"></span> <span class='number'>0</span></span> |
|
50 |
+ <span class="badge"><%= icon_tag('glyphicon-exclamation-sign', class: 'icon-white') %> <span class='number'>0</span></span> |
|
51 | 51 |
<% end %> |
52 | 52 |
</li> |
53 | 53 |
<li id='event-indicator'> |
54 | 54 |
<a href="#" class='hidden-sm hidden-xs'> |
55 |
- <span class="badge"><span class="glyphicon glyphicon-random icon-white"></span> <span class='number'>0</span> new events</span> |
|
55 |
+ <span class="badge"><%= icon_tag('glyphicon-random', class: 'icon-white') %> <span class='number'>0</span> new events</span> |
|
56 | 56 |
</a> |
57 | 57 |
</li> |
58 | 58 |
<% end %> |
@@ -26,7 +26,7 @@ |
||
26 | 26 |
|
27 | 27 |
<div class="row"> |
28 | 28 |
<div class="col-md-12"> |
29 |
- <%= link_to '<span class="glyphicon glyphicon-chevron-left"></span> Back'.html_safe, scenarios_path, class: "btn btn-default" %> |
|
29 |
+ <%= link_to icon_tag('glyphicon-chevron-left') + ' Back'.html_safe, scenarios_path, class: "btn btn-default" %> |
|
30 | 30 |
</div> |
31 | 31 |
</div> |
32 |
-</div> |
|
32 |
+</div> |
@@ -13,9 +13,9 @@ |
||
13 | 13 |
|
14 | 14 |
<div class="row"> |
15 | 15 |
<div class="col-md-12"> |
16 |
- <%= link_to '<span class="glyphicon glyphicon-chevron-left"></span> Back'.html_safe, scenarios_path, class: "btn btn-default" %> |
|
16 |
+ <%= link_to icon_tag('glyphicon-chevron-left') + ' Back'.html_safe, scenarios_path, class: "btn btn-default" %> |
|
17 | 17 |
</div> |
18 | 18 |
</div> |
19 | 19 |
</div> |
20 | 20 |
</div> |
21 |
-</div> |
|
21 |
+</div> |
@@ -43,8 +43,8 @@ |
||
43 | 43 |
<br/> |
44 | 44 |
|
45 | 45 |
<div class="btn-group"> |
46 |
- <%= link_to '<span class="glyphicon glyphicon-plus"></span> New Scenario'.html_safe, new_scenario_path, class: "btn btn-default" %> |
|
47 |
- <%= link_to '<span class="glyphicon glyphicon-plus"></span> Import Scenario'.html_safe, new_scenario_imports_path, class: "btn btn-default" %> |
|
46 |
+ <%= link_to icon_tag('glyphicon-plus') + ' New Scenario'.html_safe, new_scenario_path, class: "btn btn-default" %> |
|
47 |
+ <%= link_to icon_tag('glyphicon-plus') + ' Import Scenario'.html_safe, new_scenario_imports_path, class: "btn btn-default" %> |
|
48 | 48 |
</div> |
49 | 49 |
</div> |
50 | 50 |
</div> |
@@ -13,9 +13,9 @@ |
||
13 | 13 |
|
14 | 14 |
<div class="row"> |
15 | 15 |
<div class="col-md-12"> |
16 |
- <%= link_to '<span class="glyphicon glyphicon-chevron-left"></span> Back'.html_safe, scenarios_path, class: "btn btn-default" %> |
|
16 |
+ <%= link_to icon_tag('glyphicon-chevron-left') + ' Back'.html_safe, scenarios_path, class: "btn btn-default" %> |
|
17 | 17 |
</div> |
18 | 18 |
</div> |
19 | 19 |
</div> |
20 | 20 |
</div> |
21 |
-</div> |
|
21 |
+</div> |
@@ -25,7 +25,7 @@ |
||
25 | 25 |
|
26 | 26 |
<div class="row"> |
27 | 27 |
<div class="col-md-12"> |
28 |
- <%= link_to '<span class="glyphicon glyphicon-chevron-left"></span> Back'.html_safe, scenario_path(@scenario), class: "btn btn-default" %> |
|
28 |
+ <%= link_to icon_tag('glyphicon-chevron-left') + ' Back'.html_safe, scenario_path(@scenario), class: "btn btn-default" %> |
|
29 | 29 |
</div> |
30 | 30 |
</div> |
31 | 31 |
</div> |
@@ -15,14 +15,14 @@ |
||
15 | 15 |
<br/> |
16 | 16 |
|
17 | 17 |
<div class="btn-group"> |
18 |
- <%= link_to '<span class="glyphicon glyphicon-chevron-left"></span> Back'.html_safe, scenarios_path, class: "btn btn-default" %> |
|
19 |
- <%= link_to '<span class="glyphicon glyphicon-random"></span> View Diagram'.html_safe, scenario_diagram_path(@scenario), class: "btn btn-default" %> |
|
20 |
- <%= link_to '<span class="glyphicon glyphicon-edit"></span> Edit'.html_safe, edit_scenario_path(@scenario), class: "btn btn-default" %> |
|
18 |
+ <%= link_to icon_tag('glyphicon-chevron-left') + ' Back', scenarios_path, class: "btn btn-default" %> |
|
19 |
+ <%= link_to icon_tag('glyphicon-random') + ' View Diagram', scenario_diagram_path(@scenario), class: "btn btn-default" %> |
|
20 |
+ <%= link_to icon_tag('glyphicon-edit') + ' Edit', edit_scenario_path(@scenario), class: "btn btn-default" %> |
|
21 | 21 |
<% if @scenario.source_url.present? %> |
22 |
- <%= link_to '<span class="glyphicon glyphicon-plus"></span> Update'.html_safe, new_scenario_imports_path(:url => @scenario.source_url), class: "btn btn-default" %> |
|
22 |
+ <%= link_to icon_tag('glyphicon-plus') + ' Update', new_scenario_imports_path(url: @scenario.source_url), class: "btn btn-default" %> |
|
23 | 23 |
<% end %> |
24 |
- <%= link_to '<span class="glyphicon glyphicon-share-alt"></span> Share'.html_safe, share_scenario_path(@scenario), class: "btn btn-default" %> |
|
25 |
- <%= link_to '<span class="glyphicon glyphicon-trash"></span> Delete'.html_safe, scenario_path(@scenario), method: :delete, data: { confirm: "This will remove the '#{@scenario.name}' Scenerio from all Agents and delete it. Are you sure?" }, class: "btn btn-default" %> |
|
24 |
+ <%= link_to icon_tag('glyphicon-share-alt') + ' Share', share_scenario_path(@scenario), class: "btn btn-default" %> |
|
25 |
+ <%= link_to icon_tag('glyphicon-trash') + ' Delete', scenario_path(@scenario), method: :delete, data: { confirm: "This will remove the '#{@scenario.name}' Scenerio from all Agents and delete it. Are you sure?" }, class: "btn btn-default" %> |
|
26 | 26 |
</div> |
27 | 27 |
</div> |
28 | 28 |
</div> |
@@ -13,9 +13,9 @@ |
||
13 | 13 |
|
14 | 14 |
<div class="row"> |
15 | 15 |
<div class="col-md-12"> |
16 |
- <%= link_to '<span class="glyphicon glyphicon-chevron-left"></span> Back'.html_safe, user_credentials_path, class: "btn btn-default" %> |
|
16 |
+ <%= link_to icon_tag('glyphicon-chevron-left') + ' Back'.html_safe, user_credentials_path, class: "btn btn-default" %> |
|
17 | 17 |
</div> |
18 | 18 |
</div> |
19 | 19 |
</div> |
20 | 20 |
</div> |
21 |
-</div> |
|
21 |
+</div> |
@@ -13,9 +13,9 @@ |
||
13 | 13 |
|
14 | 14 |
<div class="row"> |
15 | 15 |
<div class="col-md-12"> |
16 |
- <%= link_to '<span class="glyphicon glyphicon-chevron-left"></span> Back'.html_safe, user_credentials_path, class: "btn btn-default" %> |
|
16 |
+ <%= link_to icon_tag('glyphicon-chevron-left') + ' Back'.html_safe, user_credentials_path, class: "btn btn-default" %> |
|
17 | 17 |
</div> |
18 | 18 |
</div> |
19 | 19 |
</div> |
20 | 20 |
</div> |
21 |
-</div> |
|
21 |
+</div> |
@@ -1,6 +1,32 @@ |
||
1 | 1 |
require 'spec_helper' |
2 | 2 |
|
3 | 3 |
describe ApplicationHelper do |
4 |
+ describe '#icon_tag' do |
|
5 |
+ it 'returns a Glyphicon icon element' do |
|
6 |
+ icon = icon_tag('glyphicon-help') |
|
7 |
+ expect(icon).to be_html_safe |
|
8 |
+ expect(Nokogiri(icon).at('span.glyphicon.glyphicon-help')).to be_a Nokogiri::XML::Element |
|
9 |
+ end |
|
10 |
+ |
|
11 |
+ it 'returns a Glyphicon icon element with an addidional class' do |
|
12 |
+ icon = icon_tag('glyphicon-help', class: 'text-info') |
|
13 |
+ expect(icon).to be_html_safe |
|
14 |
+ expect(Nokogiri(icon).at('span.glyphicon.glyphicon-help.text-info')).to be_a Nokogiri::XML::Element |
|
15 |
+ end |
|
16 |
+ |
|
17 |
+ it 'returns a FontAwesome icon element' do |
|
18 |
+ icon = icon_tag('fa-copy') |
|
19 |
+ expect(icon).to be_html_safe |
|
20 |
+ expect(Nokogiri(icon).at('i.fa.fa-copy')).to be_a Nokogiri::XML::Element |
|
21 |
+ end |
|
22 |
+ |
|
23 |
+ it 'returns a FontAwesome icon element' do |
|
24 |
+ icon = icon_tag('fa-copy', class: 'text-info') |
|
25 |
+ expect(icon).to be_html_safe |
|
26 |
+ expect(Nokogiri(icon).at('i.fa.fa-copy.text-info')).to be_a Nokogiri::XML::Element |
|
27 |
+ end |
|
28 |
+ end |
|
29 |
+ |
|
4 | 30 |
describe '#nav_link' do |
5 | 31 |
it 'returns a nav link' do |
6 | 32 |
stub(self).current_page?('/things') { false } |
@@ -9,15 +35,6 @@ describe ApplicationHelper do |
||
9 | 35 |
expect(a.text.strip).to eq('Things') |
10 | 36 |
end |
11 | 37 |
|
12 |
- it 'returns a nav link with a glyphicon' do |
|
13 |
- stub(self).current_page?('/things') { false } |
|
14 |
- nav = nav_link('Things', '/things', glyphicon: 'help') |
|
15 |
- expect(nav).to be_html_safe |
|
16 |
- a = Nokogiri(nav).at('li:not(.active) > a[href="/things"]') |
|
17 |
- expect(a.at('span.glyphicon.glyphicon-help')).to be_a Nokogiri::XML::Element |
|
18 |
- expect(a.text.strip).to eq('Things') |
|
19 |
- end |
|
20 |
- |
|
21 | 38 |
it 'returns an active nav link' do |
22 | 39 |
stub(self).current_page?('/things') { true } |
23 | 40 |
nav = nav_link('Things', '/things') |